package com.baseweb.webadmin.core.model.mapper;

import com.baseweb.webadmin.core.model.pojo.ByUserComment;
import com.baseweb.webadmin.core.model.pojo.ByUserCommentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ByUserCommentMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int countByExample(ByUserCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int deleteByExample(ByUserCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    @Delete({
        "delete from by_user_comment",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    @Insert({
        "insert into by_user_comment (user_id, table_name, ",
        "table_id, img_url, ",
        "content, status, ",
        "create_time, ",
        "update_time)",
        "values (#{userId,jdbcType=INTEGER}, #{tableName,jdbcType=VARCHAR}, ",
        "#{tableId,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, ",
        "#{content,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ByUserComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int insertSelective(ByUserComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    List<ByUserComment> selectByExample(ByUserCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    @Select({
        "select",
        "id, user_id, table_name, table_id, img_url, content, status, create_time, update_time",
        "from by_user_comment",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ByUserComment selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int updateByExampleSelective(@Param("record") ByUserComment record, @Param("example") ByUserCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int updateByExample(@Param("record") ByUserComment record, @Param("example") ByUserCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    int updateByPrimaryKeySelective(ByUserComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_user_comment
     *
     * @mbggenerated Mon Feb 06 01:08:04 CST 2017
     */
    @Update({
        "update by_user_comment",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "table_name = #{tableName,jdbcType=VARCHAR},",
          "table_id = #{tableId,jdbcType=VARCHAR},",
          "img_url = #{imgUrl,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ByUserComment record);
}